import { defineComponent, onMounted } from 'vue'
import { useStore } from 'vuex'

const App = defineComponent({
  setup () {
    const store = useStore()

    onMounted(() => {
      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
      // @ts-ignore
      import('../public/config').then(res => {
        document.title = res.default.VUE_APP_TITLE

        store.commit('setConfig', res.default)
      })
    })

    return () => (
      <div id="app">
        <router-view></router-view>
      </div>
    )
  }
})

export default App
